/*
 * @author: huangww
 * @Date: 2021-02-23 14:06:41
 * @LastEditTime: 2021-03-01 17:02:23
 * @FilePath: \fmgr\src\game\scene\LoginScene.ts
 */
class LoginScene extends core.SceneComponent {
  constructor() {
    super(core.COMPONENTTYPE.SCENE, core.SCENETYPE.LOGIN);
  }

  setResGroup() {
    this.res = core.res.test;
  }

  init() {
    super.init();
    let ubbie = core.DBMgr.getInstance().create("ubbie");
    core.DBMgr.getInstance().add(ubbie, DBVIEW.LOGIN);
    ubbie.animation.play();
    let ubDispay = ubbie.display;
    ubDispay.scaleX = ubDispay.scaleY = 0.2;
    ubDispay.x = 100;
    ubDispay.y = 400;
    this.addChild(ubDispay);

    let man = core.DBMgr.getInstance().create("Swordsman");
    core.DBMgr.getInstance().add(man, DBVIEW.LOGIN);
    man.animation.play();
    let manDispay = man.display;
    manDispay.x = 100;
    manDispay.y = 1000;
    manDispay.scaleX = manDispay.scaleY = 0.2;
    this.addChild(manDispay);

    core.DBMgr.getInstance().loadArmature("Bicycle", 1, (armature) => {
      core.DBMgr.getInstance().add(armature, DBVIEW.LOGIN);
      armature.animation.play();
      let armaturedis = armature.display;
      armaturedis.scaleX = armaturedis.scaleY = 0.1;
      armaturedis.x = 100;
      armaturedis.y = 700;
      this.addChild(armaturedis);
    });

    core.DataMgr.getInstance().request(core.DATAMODULE.COMMON, cmd.COMMON.TEST);
  }


  initEvent() {
    core.EventMgr.getInstance().addEvent(EventKey.TOKEN, () => { }, this);
  }

  initCmd() {
    core.CMDMgr.getInstance().addCmd(core.DATAMODULE.COMMON, cmd.COMMON.TEST, (data) => {
      console.log("有问题添加qq群：52697705,备注fMgr", data);
      console.log(Config.SOCKETURL)
    }, this);
  }

  release() {
    core.DBMgr.getInstance().dispose(DBVIEW.LOGIN);
  }
}